<template>
  <div class="rk-form-base-conf-body">
    <task-detail-base ref="taskDetilBaseViewRef"
      :isDisabled="isDisabled"
      :taskDetailData="taskDetailData"></task-detail-base>
  </div>
</template>
<script setup >
import XEUtils from 'xe-utils'
import TaskDetailBase from '../../dialogs/components/TaskDetailBase.vue'
import { ref } from 'vue'

const props = defineProps({
  taskDetailData: { type: [Object], default: () => ({}) }
})
const isDisabled = ref(false)
const taskDetilBaseViewRef = ref()
const baseConfForm = reactive({})
watch(
  () => props.taskDetailData,
  (newValue, oldValue) => {
    nextTick(() => {
      if (!XEUtils.isEmpty(newValue)) {
        baseConfForm.value = newValue
      } else {
        baseConfForm.value = {}
      }
    })
  },
  { deep: true, immediate: true }
)
// 获取数据
const getFormData = async function () {
  const baseData = await taskDetilBaseViewRef.value.handleBaseFromData()
  return baseData
}
// 重置数据
const resetFormData = function () {
  taskDetilBaseViewRef.value.resetForm()
}
defineExpose({
  getFormData,
  resetFormData
})
</script>
<style lang="scss" scoped>
.rk-form-base-conf-body {
  height: 100%;
  background-color: #fff;
  padding-top: 50px;
  width: 80%;
  margin: 0 auto;
}
</style>
